@extends('backend::layout')
@section('title',$page_title)
@push('styles')
    <link href="{{asset(config('view.plugin').'/layui/layui_ext/cascader/cascader.css')}}" rel="stylesheet">
@endpush
@include('backend::component.upload.upload_js')
@section('content')
    <div class="row">
        <div class="col-lg-12">
                @component('backend::component.form.form')
                @slot('form_title') {{$page_title}} @endslot
                @slot('formId') add-prize @endslot
                @slot('action') {{route('b_lottery_prize_create')}} @endslot

                    @component('backend::component.form.form-group')
                        @slot('title') 奖品名称 @endslot
                        @component('backend::component.form.input')
                            @slot('name') title @endslot
                        @endcomponent
                    @endcomponent
                    @component('backend::component.form.form-group')
                        @slot('title') 奖品图片 @endslot
                        @component('backend::component.upload.upload_img')
                            @slot('name') cover @endslot
                            @slot('group') lottery @endslot
                        @endcomponent
                    @endcomponent
                    @component('backend::component.form.form-group')
                        @slot('title') 权重 @endslot
                        @slot('remark') 值越大，抽中几率越大 @endslot
                        @component('backend::component.form.input')
                            @slot('name') power @endslot
                        @endcomponent
                    @endcomponent

                @slot('buttons')
                    @component('backend::component.form.button')
                        @slot('title') 提交 @endslot
                        @slot('params') {"formId":"#add-prize"} @endslot
                        @slot('class') btn-min-width ajax-form @endslot
                    @endcomponent
                    @component('backend::component.form.button')
                        @slot('title') 重置 @endslot
                        @slot('type') reset @endslot
                        @slot('color') danger @endslot
                        @slot('class') btn-min-width @endslot
                    @endcomponent
                @endslot
            @endcomponent
        </div>
        <!--/.col-->
    </div>
@endsection
@push('scripts')
    <script>
        layui.use(['jquery','cascader'], function(){
            var $ = layui.jquery;
            var cascader = layui.cascader;
            selectParentAction();
            function selectParentAction() {
                var data = $('#category').data('categories');
                cascader({
                    elem: "#category",
                    data: data,
                    triggerType: "change",
                    //showLastLevels:true,
                    //value: ["0"],
                    changeOnSelect:true,
                    success:function (valData) {
                        $('#cat-value').val(valData[valData.length-1]);
                    }
                });
            }
        });
    </script>
@endpush